using System;
using CodePlex.DnD4eCampaignManager.DnD4e.Interfaces;

namespace CodePlex.DnD4eCampaignManager.DnD4e
{
    public class Senses : ISenses, IEquatable<Senses>
    {
        public int SensesInsight { get; set; }
        public int SensesInsightPassive { get; set; }
        public string SensesOther { get; set; }
        public int SensesPerception { get; set; }
        public int SensesPerceptionPassive { get; set; }

        public override bool Equals(object obj)
        {
            if ( ReferenceEquals(null, obj) )
            {
                return false;
            }
            if ( ReferenceEquals(this, obj) )
            {
                return true;
            }
            if ( obj.GetType() != typeof ( Senses ) )
            {
                return false;
            }
            return Equals((Senses) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int result = SensesInsight;
                result = ( result * 397 ) ^ SensesInsightPassive;
                result = ( result * 397 ) ^ SensesPerception;
                result = ( result * 397 ) ^ SensesPerceptionPassive;
                result = ( result * 397 ) ^ ( SensesOther != null ? SensesOther.GetHashCode() : 0 );
                return result;
            }
        }

        public bool Equals(Senses other)
        {
            if ( ReferenceEquals(null, other) )
            {
                return false;
            }
            if ( ReferenceEquals(this, other) )
            {
                return true;
            }
            return other.SensesInsight == SensesInsight && other.SensesInsightPassive == SensesInsightPassive &&
                   other.SensesPerception == SensesPerception &&
                   other.SensesPerceptionPassive == SensesPerceptionPassive && Equals(other.SensesOther, SensesOther);
        }

        public static bool operator ==(Senses left, Senses right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(Senses left, Senses right)
        {
            return !Equals(left, right);
        }
    }
}